/**
 * Created with CLion.
 * Description: 
 * User: loong
 * Date: 2024/6/12
 * Time: 11:22
 */

#ifndef CARD_H
#define CARD_H
#include "Global.h"
using namespace std;
namespace Upgrade {

    class Card
    {
        friend class CardUi;

    public:
                 Card();
        explicit Card(CardRank _rank, QColor _color, CardSuit _suit,bool _trump = false);
        void     SetTrump(bool _trump) { trump = _trump; };
        bool     IsTrump() const { return trump; }
        void     Print() const;

        friend bool operator==(const Card &lhs, const Card &rhs) { return std::tie(lhs.trump, lhs.suit, lhs.rank) == std::tie(rhs.trump, rhs.suit, rhs.rank); }
        friend bool operator!=(const Card &lhs, const Card &rhs) { return !(lhs == rhs); }
        friend bool operator<(const Card &lhs, const Card &rhs) { return std::tie(lhs.trump, lhs.suit, lhs.rank) < std::tie(rhs.trump, rhs.suit, rhs.rank); }
        friend bool operator<=(const Card &lhs, const Card &rhs) { return !(rhs < lhs); }
        friend bool operator>(const Card &lhs, const Card &rhs) { return rhs < lhs; }
        friend bool operator>=(const Card &lhs, const Card &rhs) { return !(lhs < rhs); }

    public:
        CardRank                   rank;
        QColor                     color;
        CardSuit                   suit;
        bool                       trump;
        int                        score;
        static QMap<CardRank, int> score_map_;
    };

    // Q_DECLARE_METATYPE(Card);

    using CardSPtr    = std::shared_ptr<Card>;
    using CardSptrVec = QVector<CardSPtr>;
}// namespace Upgrade
Q_DECLARE_METATYPE(Upgrade::Card)
#endif//CARD_H
